package com.yifeng.repo.base.utils.action.impl;

import com.yifeng.repo.base.utils.action.BizCacheAction;
import com.yifeng.repo.base.utils.redis.worker.RedisCacheWorker;

/**
 * Created by daibing on 2023/8/26.
 */
public class BizRedisCacheAction implements BizCacheAction {
    private final RedisCacheWorker redisCacheWorker;
    private final String redisKeyPrefix;

    public BizRedisCacheAction(RedisCacheWorker redisCacheWorker, String redisKeyPrefix) {
        this.redisCacheWorker = redisCacheWorker;
        this.redisKeyPrefix = redisKeyPrefix;
    }

    @Override
    public String redisKeyPrefix() {
        return redisKeyPrefix;
    }

    @Override
    public String get(String key) {
        return redisCacheWorker.get(key);
    }

    @Override
    public void put(String key, long seconds, String value) {
        redisCacheWorker.put(key, seconds, value);
    }
}
